package com.adingxiong.useritem.service.controller;

import com.adingxiong.pojo.User;
import com.adingxiong.service.UserService;
import com.adingxiong.util.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName UserController
 * @Description TODO
 * @Author xiongchao
 * @Date 2020/7/30 15:12
 **/
@RestController
@Slf4j
public class UserController {

    @Autowired
    private UserService service;

    @GetMapping("/getUser")
    public JsonResult<User> getUserById(Integer id){
        return JsonResult.ok().data(service.getUser(id));
    }

    @GetMapping("/addSocres")
    public JsonResult addSocre(Integer id ,Integer socode){
        service.addScore(id,socode);
        return JsonResult.ok().data("添加成功");
    }
}
